import junit.framework.TestCase;
import org.junit.Test;

public class ComplexTest extends TestCase {
    Complex complex = new Complex(34,56);
    Complex complex2 = new Complex();
    public void testGetterRealPart() {
        assertEquals(34.0,complex.getterRealPart());
        complex.setter(0,-1);
        assertEquals(0.0,complex.getterRealPart());
        complex.setter(-3.6,5);
        assertEquals(-3.6,complex.getterRealPart());
    }

    public void testGetterImagePart() {
        assertEquals(56.0,complex.getterImagePart());
        complex.setter(34,-57.233);
        assertEquals(-57.233,complex.getterImagePart());
        complex.setter(4,0);
        assertEquals(0.0,complex.getterImagePart());
    }

    public void testEquals() {
        assertTrue(complex.equals(complex));
        Complex complex2 = new Complex();
        assertFalse(complex.equals(complex2));
    }

    public void testToString() {
        complex.setter(0,0);
        assertEquals("0",complex.toString());
        complex.setter(0.2,3);
        assertEquals("0.2+3.0i",complex.toString());
        complex.setter(4.5,0);
        assertEquals("4.5",complex.toString());
        complex.setter(0,6);
        assertEquals("6.0i",complex.toString());
        complex.setter(-5.6,-6.7);
        assertEquals("-5.6-6.7i",complex.toString());
    }
}